<%@ page import="com.hc.commodity.dao.impl.CommodityDaoImpl" %>
<%@ page import="com.hc.commodity.pojo.Commodity" %>
<%@ page import="java.util.List" %>
<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2021/4/6
  Time: 16:43
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>商品</title>
    <link rel="stylesheet" href="../css/bootstrap.min.css">
</head>
<body>
    <h1>欢迎使用胡氏商城</h1>
    <a href="ShoppingTrolley.jsp" class="btn btn-info">购物车</a>
    <%
        //调用dao层获取商品list集合
        CommodityDaoImpl commodityDao = new CommodityDaoImpl();
        List<Commodity> commodityList = commodityDao.findAll();
    %>
    <div class="container">
        <ul class="nav nav-pills">
            <%
                for (Commodity commodity : commodityList) {
             %>
            <li role="presentation">
                <img src="<%=commodity.getCimage()%>" width="200px" height="200px">
                <div><%=commodity.getCtitle()%></div>
                <div><%=commodity.getCprice()%>元</div>
                <a href="addShoppingTrolley.jsp?cid=<%=commodity.getCid()%>">购买</a>
            </li>
            <%
                }
            %>
        </ul>
    </div>
</body>
</html>
